home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / gundealr.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  17KB  |  519 lines

  1. /***************************************************************************
  2.  
  3. Gun Dealer memory map
  4.  
  5. driver by Nicola Salmoria
  6.  
  7. Yam! Yam!? runs on the same hardware but has a protection device which can
  8.            access RAM at e000. Program writes to e000 and expects a value back
  9.            at e001, then jumps to subroutines at e010 and e020. Also, the
  10.            player and coin inputs appear magically at e004-e006.
  11.  
  12. 0000-7fff ROM
  13. 8000-bfff ROM (banked)
  14. c400-c7ff palette RAM
  15. c800-cfff background video RAM
  16. d000-dfff foreground (scrollable) video RAM.
  17. e000-ffff work RAM
  18.  
  19. read:
  20. c000      DSW0
  21. c001      DSW1
  22. c004      COIN (Gun Dealer only)
  23. c005      IN1 (Gun Dealer only)
  24. c006      IN0 (Gun Dealer only)
  25.  
  26. write:
  27. c010-c011 foreground scroll x lo-hi (Yam Yam)
  28. c012-c013 foreground scroll y lo-hi (Yam Yam)
  29. c014      flip screen
  30. c015      Yam Yam only, maybe reset protection device
  31. c016      ROM bank selector
  32. c020-c021 foreground scroll x hi-lo (Gun Dealer)
  33. c022-c023 foreground scroll y hi-lo (Gun Dealer)
  34.  
  35. I/O:
  36. read:
  37. 01        YM2203 read
  38.  
  39. write:
  40. 00        YM2203 control
  41. 01        YM2203 write
  42.  
  43. Interrupts:
  44. Runs in interrupt mode 0, the interrupt vectors are 0xcf (RST 08h) and
  45. 0xd7 (RST 10h)
  46.  
  47. ***************************************************************************/
  48.  
  49. #include "driver.h"
  50.  
  51.  
  52. extern unsigned char *gundealr_bg_videoram,*gundealr_fg_videoram;
  53.  
  54. WRITE_HANDLER( gundealr_paletteram_w );
  55. WRITE_HANDLER( gundealr_bg_videoram_w );
  56. WRITE_HANDLER( gundealr_fg_videoram_w );
  57. WRITE_HANDLER( gundealr_fg_scroll_w );
  58. WRITE_HANDLER( yamyam_fg_scroll_w );
  59. WRITE_HANDLER( gundealr_flipscreen_w );
  60. void gundealr_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  61. int gundealr_vh_start(void);
  62.  
  63.  
  64. static int input_ports_hack;
  65.  
  66. static int yamyam_interrupt(void)
  67. {
  68.     if (cpu_getiloops() == 0)
  69.     {
  70.         if (input_ports_hack)
  71.         {
  72.             unsigned char *RAM = memory_region(REGION_CPU1);
  73.             RAM[0xe004] = readinputport(4);    /* COIN */
  74.             RAM[0xe005] = readinputport(3);    /* IN1 */
  75.             RAM[0xe006] = readinputport(2);    /* IN0 */
  76.         }
  77.         return 0xd7;    /* RST 10h vblank */
  78.     }
  79.     if ((cpu_getiloops() & 1) == 1) return 0xcf;    /* RST 08h sound (hand tuned) */
  80.     else return ignore_interrupt();
  81. }
  82.  
  83. static WRITE_HANDLER( yamyam_bankswitch_w )
  84. {
  85.      int bankaddress;
  86.     unsigned char *RAM = memory_region(REGION_CPU1);
  87.  
  88.     bankaddress = 0x10000 + (data & 0x07) * 0x4000;
  89.     cpu_setbank(1,&RAM[bankaddress]);
  90. }
  91.  
  92. static WRITE_HANDLER( yamyam_protection_w )
  93. {
  94.     unsigned char *RAM = memory_region(REGION_CPU1);
  95.  
  96. logerror("e000 = %02x\n",RAM[0xe000]);
  97.     RAM[0xe000] = data;
  98.     if (data == 0x03) RAM[0xe001] = 0x03;
  99.     if (data == 0x04) RAM[0xe001] = 0x04;
  100.     if (data == 0x05) RAM[0xe001] = 0x05;
  101.     if (data == 0x0a) RAM[0xe001] = 0x08;
  102.     if (data == 0x0d) RAM[0xe001] = 0x07;
  103.  
  104.     if (data == 0x03)
  105.     {
  106.         /*
  107.         read dip switches
  108.         3a 00 c0  ld   a,($c000)
  109.         47        ld   b,a
  110.         3a 01 c0  ld   a,($c001)
  111.         c9        ret
  112.         */
  113.         RAM[0xe010] = 0x3a;
  114.         RAM[0xe011] = 0x00;
  115.         RAM[0xe012] = 0xc0;
  116.         RAM[0xe013] = 0x47;
  117.         RAM[0xe014] = 0x3a;
  118.         RAM[0xe015] = 0x01;
  119.         RAM[0xe016] = 0xc0;
  120.         RAM[0xe017] = 0xc9;
  121.     }
  122.     if (data == 0x05)
  123.     {
  124.         /*
  125.         add a to hl
  126.         c5        push    bc
  127.         010000    ld      bc,#0000
  128.         4f        ld      c,a
  129.         09        add     hl,bc
  130.         c1        pop     bc
  131.         c9        ret
  132.         */
  133.         RAM[0xe020] = 0xc5;
  134.         RAM[0xe021] = 0x01;
  135.         RAM[0xe022] = 0x00;
  136.         RAM[0xe023] = 0x00;
  137.         RAM[0xe024] = 0x4f;
  138.         RAM[0xe025] = 0x09;
  139.         RAM[0xe026] = 0xc1;
  140.         RAM[0xe027] = 0xc9;
  141.         /*
  142.         lookup data in table
  143.         cd20e0    call    #e020
  144.         7e        ld      a,(hl)
  145.         c9        ret
  146.         */
  147.         RAM[0xe010] = 0xcd;
  148.         RAM[0xe011] = 0x20;
  149.         RAM[0xe012] = 0xe0;
  150.         RAM[0xe013] = 0x7e;
  151.         RAM[0xe014] = 0xc9;
  152.     }
  153. }
  154.  
  155. static void init_gundealr(void)
  156. {
  157.     input_ports_hack = 0;
  158. }
  159.  
  160. static void init_yamyam(void)
  161. {
  162.     input_ports_hack = 1;
  163.     install_mem_write_handler(0, 0xe000, 0xe000, yamyam_protection_w);
  164. }
  165.  
  166.  
  167.  
  168. static struct MemoryReadAddress readmem[] =
  169. {
  170.     { 0x0000, 0x7fff, MRA_ROM },
  171.     { 0x8000, 0xbfff, MRA_BANK1 },
  172.     { 0xc000, 0xc000, input_port_0_r },    /* DSW0 */
  173.     { 0xc001, 0xc001, input_port_1_r },    /* DSW1 */
  174.     { 0xc004, 0xc004, input_port_2_r },    /* COIN (Gun Dealer only) */
  175.     { 0xc005, 0xc005, input_port_3_r },    /* IN1 (Gun Dealer only) */
  176.     { 0xc006, 0xc006, input_port_4_r },    /* IN0 (Gun Dealer only) */
  177.     { 0xc400, 0xffff, MRA_RAM },
  178.     { -1 }    /* end of table */
  179. };
  180.  
  181. static struct MemoryWriteAddress writemem[] =
  182. {
  183.     { 0x0000, 0xbfff, MWA_ROM },
  184.     { 0xc010, 0xc013, yamyam_fg_scroll_w },        /* Yam Yam only */
  185.     { 0xc014, 0xc014, gundealr_flipscreen_w },
  186.     { 0xc016, 0xc016, yamyam_bankswitch_w },
  187.     { 0xc020, 0xc023, gundealr_fg_scroll_w },    /* Gun Dealer only */
  188.     { 0xc400, 0xc7ff, gundealr_paletteram_w, &paletteram },
  189.     { 0xc800, 0xcfff, gundealr_bg_videoram_w, &gundealr_bg_videoram },
  190.     { 0xd000, 0xdfff, gundealr_fg_videoram_w, &gundealr_fg_videoram },
  191.     { 0xe000, 0xffff, MWA_RAM },
  192.     { -1 }    /* end of table */
  193. };
  194.  
  195. static struct IOReadPort readport[] =
  196. {
  197.     { 0x01, 0x01, YM2203_read_port_0_r },
  198.     { -1 }    /* end of table */
  199. };
  200.  
  201. static struct IOWritePort writeport[] =
  202. {
  203.     { 0x00, 0x00, YM2203_control_port_0_w },
  204.     { 0x01, 0x01, YM2203_write_port_0_w },
  205.     { -1 }    /* end of table */
  206. };
  207.  
  208.  
  209.  
  210. INPUT_PORTS_START( gundealr )
  211.     PORT_START    /* DSW0 */
  212.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
  213.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  214.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  215.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  216.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  217.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  218.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
  219.     PORT_DIPSETTING(    0x0c, "Easy" )
  220.     PORT_DIPSETTING(    0x08, "Medium" )
  221.     PORT_DIPSETTING(    0x04, "Hard" )
  222.     PORT_DIPSETTING(    0x00, "Hardest" )
  223.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  224.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  225.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  226.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  227.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  228.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  229.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  230.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  231.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  232.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
  233.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  234.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  235.  
  236.     PORT_START    /* DSW1 */
  237.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
  238.     PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
  239.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
  240.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  241.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
  242.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  243.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  244.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  245.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
  246.     PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) )
  247.     PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
  248.     PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) )
  249.     PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
  250.     PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
  251.     PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
  252.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) )
  253.     PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
  254.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
  255.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Unknown ) )
  256.     PORT_DIPSETTING(    0x00, "0" )
  257.     PORT_DIPSETTING(    0x40, "1" )
  258.     PORT_DIPSETTING(    0x80, "2" )
  259.     PORT_DIPSETTING(    0xc0, "3" )
  260.  
  261.     PORT_START    /* COIN */
  262.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  263.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  264.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  265.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  266.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  267.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  268.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  269.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  270.  
  271.     PORT_START    /* IN1 */
  272.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER2 )
  273.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER2 )
  274.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER2 )
  275.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER2 )
  276.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  277.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  278.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  279.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  280.  
  281.     PORT_START    /* IN0 */
  282.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER1 )
  283.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER1 )
  284.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER1 )
  285.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER1 )
  286.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  287.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  288.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  289.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  290. INPUT_PORTS_END
  291.  
  292. INPUT_PORTS_START( yamyam )
  293.     PORT_START    /* DSW0 */
  294.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  295.     PORT_DIPSETTING(    0x00, "3" )
  296.     PORT_DIPSETTING(    0x01, "4" )
  297.     PORT_DIPSETTING(    0x02, "5" )
  298.     PORT_DIPSETTING(    0x03, "6" )
  299.     PORT_DIPNAME( 0x0c, 0x00, "Difficulty?" )
  300.     PORT_DIPSETTING(    0x00, "Easy?" )
  301.     PORT_DIPSETTING(    0x04, "Medium?" )
  302.     PORT_DIPSETTING(    0x08, "Hard?" )
  303.     PORT_DIPSETTING(    0x0c, "Hardest?" )
  304.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  305.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  306.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  307.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  308.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  309.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  310.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  311.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  312.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  313.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
  314.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  315.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  316.  
  317.     PORT_START    /* DSW1 */
  318.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
  319.     PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
  320.     PORT_DIPSETTING(    0x06, DEF_STR( 4C_1C ) )
  321.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  322.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  323. /*    PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) ) */
  324. /*    PORT_DIPSETTING(    0x02, DEF_STR( 1C_1C ) ) */
  325. /*    PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) ) */
  326.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  327.     PORT_DIPNAME( 0x38, 0x00, DEF_STR( Coin_B ) )
  328.     PORT_DIPSETTING(    0x38, DEF_STR( 5C_1C ) )
  329.     PORT_DIPSETTING(    0x30, DEF_STR( 4C_1C ) )
  330.     PORT_DIPSETTING(    0x28, DEF_STR( 3C_1C ) )
  331.     PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
  332. /*    PORT_DIPSETTING(    0x18, DEF_STR( 1C_1C ) ) */
  333. /*    PORT_DIPSETTING(    0x10, DEF_STR( 1C_1C ) ) */
  334. /*    PORT_DIPSETTING(    0x08, DEF_STR( 1C_1C ) ) */
  335.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  336.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Free_Play ) )
  337.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  338.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  339.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  340.  
  341.     PORT_START    /* COIN */
  342.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  343.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  344.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  345.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  346.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  347.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT )    /* "TEST" */
  348.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  349.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  350.  
  351.     PORT_START    /* IN1 */
  352.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER2 )
  353.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER2 )
  354.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER2 )
  355.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER2 )
  356.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  357.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  358.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  359.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  360.  
  361.     PORT_START    /* IN0 */
  362.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER1 )
  363.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER1 )
  364.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER1 )
  365.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER1 )
  366.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  367.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  368.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  369.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  370. INPUT_PORTS_END
  371.  
  372.  
  373.  
  374. static struct GfxLayout charlayout =
  375. {
  376.     8,8,    /* 8*8 characters */
  377.     2048,    /* 2048 characters */
  378.     4,    /* 4 bits per pixel */
  379.     { 0, 1, 2, 3 },
  380.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
  381.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  382.     32*8    /* every char takes 32 consecutive bytes */
  383. };
  384.  
  385. static struct GfxLayout spritelayout =
  386. {
  387.     16,16,    /* 16*16 sprites */
  388.     1024,    /* 1024 sprites */
  389.     4,    /* 4 bits per pixel */
  390.     { 0, 1, 2, 3 },
  391.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
  392.             16*32+0*4, 16*32+1*4, 16*32+2*4, 16*32+3*4, 16*32+4*4, 16*32+5*4, 16*32+6*4, 16*32+7*4 },
  393.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  394.             8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
  395.     128*8    /* every sprite takes 128 consecutive bytes */
  396. };
  397.  
  398. static struct GfxDecodeInfo gfxdecodeinfo[] =
  399. {
  400.     { REGION_GFX1, 0, &charlayout,     0, 16 },    /* colors 0-255 */
  401.     { REGION_GFX2, 0, &spritelayout, 256, 16 },    /* colors 256-511 */
  402.     { -1 } /* end of array */
  403. };
  404.  
  405.  
  406.  
  407. static struct YM2203interface ym2203_interface =
  408. {
  409.     1,            /* 1 chip */
  410.     1500000,    /* 1.5 MHz ?????? */
  411.     { YM2203_VOL(25,25) },
  412.     { 0 },
  413.     { 0 },
  414.     { 0 },
  415.     { 0 }
  416. };
  417.  
  418.  
  419.  
  420. static struct MachineDriver machine_driver_gundealr =
  421. {
  422.     /* basic machine hardware */
  423.     {
  424.         {
  425.             CPU_Z80,
  426.             8000000,    /* 8 Mhz ??? */
  427.             readmem,writemem,readport,writeport,
  428.             yamyam_interrupt,4    /* ? */
  429.         }
  430.     },
  431.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  432.     1,    /* single CPU, no need for interleaving */
  433.     0,
  434.  
  435.     /* video hardware */
  436.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  437.     gfxdecodeinfo,
  438.     512, 512,
  439.     0,
  440.  
  441.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  442.     0,
  443.     gundealr_vh_start,
  444.     0,
  445.     gundealr_vh_screenrefresh,
  446.  
  447.     /* sound hardware */
  448.     0,0,0,0,
  449.     {
  450.         {
  451.             SOUND_YM2203,
  452.             &ym2203_interface
  453.         }
  454.     }
  455. };
  456.  
  457.  
  458.  
  459. /***************************************************************************
  460.  
  461.   Game driver(s)
  462.  
  463. ***************************************************************************/
  464.  
  465. ROM_START( gundealr )
  466.     ROM_REGION( 0x30000, REGION_CPU1 )    /* 64k for code + 128k for banks */
  467.     ROM_LOAD( "gundealr.1",   0x00000, 0x10000, 0x5797e830 )
  468.     ROM_RELOAD(               0x10000, 0x10000 )    /* banked at 0x8000-0xbfff */
  469.  
  470.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  471.     ROM_LOAD( "gundealr.3",   0x00000, 0x10000, 0x01f99de2 )
  472.  
  473.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  474.     ROM_LOAD( "gundealr.2",   0x00000, 0x20000, 0x7874ec41 )
  475. ROM_END
  476.  
  477. ROM_START( gundeala )
  478.     ROM_REGION( 0x30000, REGION_CPU1 )    /* 64k for code + 128k for banks */
  479.     ROM_LOAD( "gundeala.1",   0x00000, 0x10000, 0xd87e24f1 )
  480.     ROM_RELOAD(               0x10000, 0x10000 )    /* banked at 0x8000-0xbfff */
  481.  
  482.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  483.     ROM_LOAD( "gundeala.3",   0x00000, 0x10000, 0x836cf1a3 )
  484.  
  485.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  486.     ROM_LOAD( "gundeala.2",   0x00000, 0x20000, 0x4b5fb53c )
  487. ROM_END
  488.  
  489. ROM_START( yamyam )
  490.     ROM_REGION( 0x30000, REGION_CPU1 )    /* 64k for code + 128k for banks */
  491.     ROM_LOAD( "b3.f10",       0x00000, 0x20000, 0x96ae9088 )
  492.     ROM_RELOAD(               0x10000, 0x20000 )    /* banked at 0x8000-0xbfff */
  493.  
  494.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  495.     ROM_LOAD( "b2.d16",       0x00000, 0x10000, 0xcb4f84ee )
  496.  
  497.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  498.     ROM_LOAD( "b1.a16",       0x00000, 0x20000, 0xb122828d )
  499. ROM_END
  500.  
  501. /* only gfx are different, code is the same */
  502. ROM_START( wiseguy )
  503.     ROM_REGION( 0x30000, REGION_CPU1 )    /* 64k for code + 128k for banks */
  504.     ROM_LOAD( "b3.f10",       0x00000, 0x20000, 0x96ae9088 )
  505.     ROM_RELOAD(               0x10000, 0x20000 )    /* banked at 0x8000-0xbfff */
  506.  
  507.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  508.     ROM_LOAD( "wguyb2.bin",   0x00000, 0x10000, 0x1c684c46 )
  509.  
  510.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  511.     ROM_LOAD( "b1.a16",       0x00000, 0x20000, 0xb122828d )
  512. ROM_END
  513.  
  514.  
  515. GAME( 1990, gundealr, 0,        gundealr, gundealr, gundealr, ROT270, "Dooyong", "Gun Dealer (set 1)" )
  516. GAME( ????, gundeala, gundealr, gundealr, gundealr, gundealr, ROT270, "Dooyong", "Gun Dealer (set 2)" )
  517. GAME( 1990, yamyam,   0,        gundealr, yamyam,   yamyam,   ROT0,   "Dooyong", "Yam! Yam!?" )
  518. GAME( 1990, wiseguy,  yamyam,   gundealr, yamyam,   yamyam,   ROT0,   "Dooyong", "Wise Guy" )
  519.